package com.htwy.kits;

import java.security.SecureRandom;
import java.util.Random;

public class RandomKit {

    public static String getNextSalt(int length){
        Random random = new SecureRandom();
        byte[] salt = new byte[length];
        random.nextBytes(salt);
        StringBuffer hexString = new StringBuffer();
        for (int i = 0; i < salt.length; i++) {
            String hex = Integer.toHexString(0xf & salt[i]);
            hexString.append(hex);
        }
        return hexString.toString();
    }

}
